package com.senyin.pathSearchUtil.controller;

import com.senyin.pathSearchUtil.common.BaseResponse;
import com.senyin.pathSearchUtil.common.ResultResponse;
import com.senyin.pathSearchUtil.model.FileInfos;
import com.senyin.pathSearchUtil.service.FileInfosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.*;

@RestController
@RequestMapping("/fileInfos")
public class FileInfosController {

    @Resource
    private FileInfosService service;

    @PostMapping("/save")
    public BaseResponse<String> save(@RequestBody Map fileData){
        Object fileList = fileData.get("fileList");
        ArrayList<LinkedHashMap<String,Object>> fileInfos = (ArrayList<LinkedHashMap<String,Object>>) fileList;
        return service.save(fileInfos);
    }

    @GetMapping("/get")
    public BaseResponse<String> get(){
        System.out.println(service.get().getData().toString());
        return service.get();
    }

}
